<base href="<?php echo base_url();?>" />
<table id="user">
	<thead>
	    <tr>
	      <th>ID</th>
	      <th>Benutzername</th>
	      <th>Admin</th>
	      <th>Lehrer</th>
	      <th>Schüler</th>
	      <th class="filter-false remove sorter-false">Bearbeiten</th>      
	    </tr>
  	</thead>
	<tbody >
		<?php foreach ($user as $row): ?>
	    <tr>
	    	<td><?php echo $row['id'];?></td>
	        <td><?php echo $row['username'];?></td>
	        <td><?php echo $row['Admin'];?></td>
	        <td><?php echo $row['Lehrer'];?></td>
	        <td><?php echo $row['Schueler'];?></td>
	        <td>
		        <?php $this->load->helper(array('form')); ?>
		    	<?php echo validation_errors(); ?>
				<?php echo form_open('user_controller/validate_view')?>
				<input type="input" name="userid" value=<?php echo $row['id'];?> hidden="true" />
	        	<input class="art-button" type='submit' name='submit' value='Ändern' > 	       
	        </td>
	 		</form>        
	    </tr>
		<?php endforeach; ?>
	</tbody>
</table>
<?php $this->load->helper(array('form')); ?>
<?php echo validation_errors(); ?>
<?php echo form_open('user_controller/create_view')?>
	<input class="art-button" type='submit' name='submit' value='Neuer User' > 
</form>
<!--    ######################################   -->
	
<div id="pager" class="pager">
	<form>
		<img src="<?php echo base_url();?>assets/tablesorter/addons/pager/icons/first.png" class="first"/>
		<img src="<?php echo base_url();?>assets/tablesorter/addons/pager/icons/prev.png" class="prev"/>
		<input type="text" class="pagedisplay" disabled="disabled"/>
		<img src="<?php echo base_url();?>assets/tablesorter/addons/pager/icons/next.png" class="next"/>
		<img src="<?php echo base_url();?>assets/tablesorter/addons/pager/icons/last.png" class="last"/>
		<select class="pagesize">
			<option selected="selected"  value="10">10</option>
			<option value="20">20</option>
			<option value="30">30</option>
			<option  value="40">40</option>
		</select>
	</form>
</div>
<!--    ######################################   -->

<?php
$this->load->helper(array('form'));
echo validation_errors(); 
echo form_open('kurseteilnehmer_controller/set_kurseteilnehmer');
echo "<input type='input' name='kursecode' hidden='true' value='".$kursecode."'/>";
echo "<table id='kursteilnehmer'>
		<thead>
	    	<tr>
		      	<th class='sorter-false'>Teilnehmer. </th>
		      	<th class='sorter-false'>User ID </th>
	    	</tr>
		</thead>
		<tbody>";
			$a = 1;
			foreach($kurseteilnehmer as $row):
	  echo "<tr>
				<td>".$a." </td>
				<td>";
				echo "<input type='input' name='userid[".$a."]' value='".$row['UserID']."'/><br />";				
		   echo"</td>
			</tr>";
			$a++;
			endforeach;		
			for($i = $a; $i <= $Anzahl; $i++):
	  echo "<tr>
				<td>".$i." </td>
				<td>";
				echo "<input type='input' name='userid[".$i."]' /><br />";				
		   echo"</td>
			</tr>";
			endfor; 
 echo "</tbody>
	</table>";


echo "<input class='art-button' type='submit' name='submit' value='Teilnehmer Speichern' > <br /> <br />
	 </form>";

?>




<script>
$(document).ready(function() 
    { 
        $("#user").tablesorter({ 
        theme: 'green',
        widthFixed: false, 
        widgets: ['zebra','filter'] 
    })
    $("#user").tablesorterPager({container: $("#pager")});
    
    $("#kursteilnehmer").tablesorter({ 
        theme: 'green',
        widthFixed: false, 
        widgets: ['zebra'] 
    })
    } 
); 
</script>
